﻿using System;
using Module.Core.LoginSystem.Commons;
using Module.Core.LoginSystem.Commons.Framwork;
using Module.Core.LoginSystem.Commons.Utilities;
using Module.Core.LoginSystem.Components.Audits;

using Module.Core.LoginSystem.Components.Users;

namespace Web.Cms.UserControls
{
    public partial class Header : AdminUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)// lblCurrentUser.Text = CurrentUser.Username;
                lblUserLogin.Text = CurrentUser.FirstName + " " + CurrentUser.LastName;
        }

        protected void rdoLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            //VietAnswer.Modules.MultiLanguage.LanguageUtility.SetLanguage(rdoLanguage.SelectedValue);
            //VietAnswer.Modules.MultiLanguage.LanguageUtility.SetLanguage("vi-VN");
            //VietAnswer.Modules.MultiLanguage.LanguageUtility.SetLanguage("USD");
            Response.Redirect(UIProcess.DEFAULT_CP_PAGE);
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            //string langCulture = VietAnswer.Modules.MultiLanguage.LanguageUtility.GetLanguage();
            //MiscUtility.SelectItemFromList(rdoLanguage, langCulture);
            //MiscUtility.SelectItemFromList(rdoPriceUnit, ExchangeRateController.GetPriceUnit());
        }

        protected void rdoPriceUnit_SelectedIndexChanged(object sender, EventArgs e)
        {
            //ExchangeRateController.SetPriceUnit(rdoPriceUnit.SelectedValue);
            //Response.Redirect(MiscUtility.UpdateQueryStringItem(Request,"unit", rdoPriceUnit.SelectedValue));
        }
        protected void lnkLogout_Click(object sender, EventArgs e)
        {
            UserController.Logout();
            AuditController.CreateAuditQ(0, (int)AuditCode.Logout, "", CurrentUser.UserID, 0, "Hệ thống website", 1, DateTime.Now);
            Response.Redirect(Request.RawUrl);
        }
    }
}